﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

namespace AllInOne.Entity
{
    public class CarInfo
    {
        public string hphm { get; set; } //号牌号码
        public string hpzl { get; set; } //号牌种类
        public string hpzlmc { get; set; }
        public string clsbdh { get; set; }//车辆识别代号
        public string fdjh { get; set; }//发动机号
        public string clpp1 { get; set; } //中文品牌
        public string clxh { get; set; }//车辆型号
        public string syr { get; set; } //所有人
        public string zsxxdz { get; set; } //住所详细地址

        public string sfzmhm { get; set; }

        public string yzbm { get; set; }

        public string sjhm { get; set; }
        public string lxdh { get; set; }

        public string fzjg { get; set; }
        public string bxzzrq { get; set; }

        public string xh { get; set; }

        public string yxqz { get; set; }

        public string lsh { get; set; }


        public string xszbh { get; set; }



        public static CarInfo ParseObject(JObject json)
        {
            try
            {
                if (json != null)
                {
                    CarInfo carInfo = new CarInfo();
                    carInfo.hphm = json["hphm"] != null ? json["hphm"].ToString() : "";
                    carInfo.hpzl = json["hpzl"] != null ? json["hpzl"].ToString() : "";
                    carInfo.hpzlmc = json["hpzlmc"] != null ? json["hpzlmc"].ToString() : "";
                    carInfo.clsbdh = json["clsbdh"] != null ? json["clsbdh"].ToString() : "";
                    carInfo.fdjh = json["fdjh"] != null ? json["fdjh"].ToString() : "";
                    carInfo.clpp1 = json["clpp1"] != null ? json["clpp1"].ToString() : "";
                    carInfo.clxh = json["clxh"] != null ? json["clxh"].ToString() : "";
                    carInfo.zsxxdz = json["zzxxdz"] != null ? json["zzxxdz"].ToString() : "";
                    carInfo.fzjg = json["fzjg"] != null ? json["fzjg"].ToString() : "";
                    carInfo.sfzmhm = json["sfzmhm"] != null ? json["sfzmhm"].ToString() : "";

                    carInfo.syr = json["syr"] != null ? json["syr"].ToString() : "";
                    carInfo.yzbm = json["yzbm1"] != null ? json["yzbm1"].ToString() : "";
                    carInfo.sjhm = json["sjhm"] != null ? json["sjhm"].ToString() : "";
                    carInfo.lxdh = json["lxdh"] != null ? json["lxdh"].ToString() : "";
                    carInfo.bxzzrq = json["bxzzrq"] != null ? json["bxzzrq"].ToString() : "";
                    carInfo.xh = json["xh"] != null ? json["xh"].ToString() : "";
                    carInfo.yxqz = json["yxqz"] != null ? json["yxqz"].ToString() : "";
                    carInfo.lsh = json["lsh"] != null ? json["lsh"].ToString() : "";
                    carInfo.xszbh = json["xszbh"] != null ? json["xszbh"].ToString() : "";


                    return carInfo;
                }
            }
            catch (Exception e)
            {

                SimpleConsole.WriteError(e.Message, typeof(DrivingLicence));
            }
            return null;

        }
    }
}
